using System.ComponentModel.DataAnnotations;

namespace S.M.SmartMedical.Domain.Entities
{
    /// <summary>
    /// 开单申请项目关联实体
    /// 用于存储开单申请中包含的具体检查项目
    /// </summary>
    public class OrderApplicationItem : BaseEntity
    {
        /// <summary>
        /// 开单申请ID
        /// </summary>
        [Required]
        public int OrderApplicationId { get; set; }

        /// <summary>
        /// 开单申请（导航属性）
        /// </summary>
        public virtual OrderApplication OrderApplication { get; set; } = null!;

        /// <summary>
        /// 医疗项目ID
        /// </summary>
        [Required]
        public int MedicalProjectId { get; set; }

        /// <summary>
        /// 医疗项目（导航属性）
        /// </summary>
        public virtual MedicalProject MedicalProject { get; set; } = null!;

        /// <summary>
        /// 项目名称（冗余字段，用于历史记录）
        /// </summary>
        [Required]
        [MaxLength(100)]
        public string ProjectName { get; set; } = string.Empty;

        /// <summary>
        /// 项目价格（冗余字段，用于历史记录）
        /// </summary>
        [Required]
        public decimal ProjectPrice { get; set; }

        /// <summary>
        /// 项目描述（冗余字段，用于历史记录）
        /// </summary>
        [MaxLength(500)]
        public string? ProjectDescription { get; set; }

        /// <summary>
        /// 数量（通常为1）
        /// </summary>
        [Required]
        public int Quantity { get; set; } = 1;

        /// <summary>
        /// 小计金额
        /// </summary>
        [Required]
        public decimal SubTotal { get; set; }

        /// <summary>
        /// 项目状态备注
        /// </summary>
        [MaxLength(200)]
        public string? StatusRemarks { get; set; }

        /// <summary>
        /// 检查结果文件路径
        /// </summary>
        [MaxLength(500)]
        public string? ResultFilePath { get; set; }

        /// <summary>
        /// 检查完成时间
        /// </summary>
        public DateTime? CompletedTime { get; set; }
    }
}